<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
      <el-form-item label="订单编号" prop="orderCode">
        <el-input v-model="queryParams.orderCode" placeholder="请输入订单编号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="订单类型" prop="orderType">
        <el-select v-model="form.orderType" placeholder="请选择订单类型">
          <el-option v-for="dict in dict.type.mes_order_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="客户ID" prop="clientId">
        <el-input v-model="queryParams.clientId" placeholder="请输入客户ID" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>-->
      <el-form-item label="客户编码" prop="clientCode">
        <el-input v-model="queryParams.clientCode" placeholder="请输入客户编码" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="客户名称" prop="clientName">
        <el-input v-model="queryParams.clientName" placeholder="请输入客户名称" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="规格型号" prop="productSpc">
        <el-input v-model="queryParams.productSpc" placeholder="请输入规格型号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="订单日期" prop="orderDate">
        <el-date-picker clearable v-model="queryParams.orderDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择订单日期"></el-date-picker>
      </el-form-item>
      <el-form-item label="销售人" prop="salesman">
        <el-input v-model="queryParams.salesman" placeholder="请输入销售人" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!--      <el-form-item label="预留字段1" prop="attr1">
        <el-input v-model="queryParams.attr1" placeholder="请输入预留字段1" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="预留字段2" prop="attr2">
        <el-input v-model="queryParams.attr2" placeholder="请输入预留字段2" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['mes:md:order:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['mes:md:order:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['mes:md:order:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['mes:md:order:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="订单ID" align="center" prop="orderId" />
      <el-table-column label="订单编号" align="center" prop="orderCode" />
      <el-table-column label="订单类型" align="center" key="orderType" prop="orderType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.mes_order_type" :value="scope.row.orderType" />
        </template>
      </el-table-column>
      <!-- <el-table-column label="客户ID" align="center" prop="clientId" /> -->
      <el-table-column label="客户编码" align="center" prop="clientCode" />
      <el-table-column label="客户名称" align="center" prop="clientName" />
      <!-- <el-table-column label="规格型号" align="center" prop="productSpc" /> -->
      <el-table-column label="订单日期" align="center" prop="orderDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.orderDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="销售人" align="center" prop="salesman" />
      <!-- <el-table-column label="预留字段1" align="center" prop="attr1" />
      <el-table-column label="预留字段2" align="center" prop="attr2" />-->
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['mes:md:order:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['mes:md:order:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />

    <!-- 添加或修改订单对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
      <el-form ref="form" :model="form" size="small" :rules="rules" :inline="true" label-width="80px">
        <el-form-item label="订单编号" prop="orderCode">
          <el-input v-model="form.orderCode" placeholder="请输入订单编号" />
        </el-form-item>
        <el-form-item label="订单类型" prop="orderType">
          <el-select v-model="form.orderType" placeholder="请选择订单类型">
            <el-option v-for="dict in dict.type.mes_order_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="客户ID" prop="clientId">
          <el-input v-model="form.clientId" placeholder="请输入客户ID" />
        </el-form-item>-->
        <el-form-item label="客户编码" prop="clientCode">
          <el-input v-model="form.clientCode" placeholder="请输入客户编码">
            <el-button slot="append" @click="handleSelectClient" icon="el-icon-search"></el-button>
          </el-input>
          <ClientSelect ref="clientSelect" @onSelected="onClientSelected"></ClientSelect>
        </el-form-item>
        <el-form-item label="客户名称" prop="clientName">
          <el-input v-model="form.clientName" disabled placeholder="请选择客户编码" />
        </el-form-item>
        <!-- <el-form-item label="规格型号" prop="productSpc">
          <el-input v-model="form.productSpc" placeholder="请输入规格型号" />
        </el-form-item>-->
        <el-form-item label="订单日期" prop="orderDate">
          <el-date-picker clearable v-model="form.orderDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择订单日期"></el-date-picker>
        </el-form-item>
        <el-form-item label="销售人" prop="salesman">
          <el-input v-model="form.salesman" placeholder="请输入销售人" />
        </el-form-item>
        <!--        <el-form-item label="数据行状态(0:正常/1:删除)" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入数据行状态(0:正常/1:删除)" />
        </el-form-item>-->
        <!-- <el-form-item label="预留字段1" prop="attr1">
          <el-input v-model="form.attr1" placeholder="请输入预留字段1" />
        </el-form-item>
        <el-form-item label="预留字段2" prop="attr2">
          <el-input v-model="form.attr2" placeholder="请输入预留字段2" />
        </el-form-item>-->
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" :rows="1" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-divider content-position="center">订单子项信息</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddMdOrderItem">添加</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMdOrderItem">删除</el-button>
          </el-col>
        </el-row>
        <el-table :data="mdOrderItemList" :row-class-name="rowMdOrderItemIndex" @selection-change="handleMdOrderItemSelectionChange" ref="mdOrderItem">
          <el-table-column type="selection" width="50" align="center" />
          <el-table-column label="序号" align="center" prop="index" width="50" />
          <el-table-column label="工作单号" align="center" prop="workorderCode" width="150"></el-table-column>
          <el-table-column label="产品编号" align="center" prop="productCode" width="240"></el-table-column>
          <el-table-column label="产品名称" align="center" prop="productName" width="150"></el-table-column>
          <el-table-column label="规格型号" align="center" prop="productSpc" width="150">
            <!-- <template slot-scope="scope">
              <el-link type="primary" :underline="false" @click="openSpc(scope.row.productSpc)">规格详情</el-link>
            </template>-->
          </el-table-column>
          <el-table-column label="单位" align="center" prop="unitOfMeasure" width="220"></el-table-column>
          <el-table-column label="工序代号" align="center" prop="processCode" width="150"></el-table-column>
          <el-table-column label="订单数量" align="center" prop="orderCount" width="150"></el-table-column>
          <el-table-column label="库存数量" align="center" prop="stockCount" width="150"></el-table-column>
          <el-table-column label="生产数量" align="center" prop="quantity" width="150"></el-table-column>
          <el-table-column label="投料点" align="center" prop="feedingPoint" width="150"></el-table-column>
          <el-table-column label="订单日期" align="center" prop="orderDate" width="240"></el-table-column>
          <el-table-column label="需求日期" align="center" prop="requestDate" width="240"></el-table-column>
          <el-table-column label="急缓" align="center" prop="priority" width="150"></el-table-column>
          <el-table-column label="单据状态" align="center" key="status" prop="status" width="240">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.mes_md_order_status" :value="scope.row.status" />
            </template>
          </el-table-column>
          <el-table-column label="箱子资料" align="center" prop="boxInfo" width="150"></el-table-column>
          <el-table-column label="底片" align="center" prop="negative" width="150"></el-table-column>
          <el-table-column label="价格" align="center" prop="price" width="150"></el-table-column>
        </el-table>

        <!-- 规格属性展示框 -->
        <el-dialog title="规格属性列表" :visible.sync="dialogTableVisible" width="500px" append-to-body>
          <el-table :data="specificationData">
            <!-- <el-table-column v-for="item in form.specification" property="attrValue" :label="item.attrName" width="150"></el-table-column> -->
            <el-table-column property="attrName" label="规格名" width="150"></el-table-column>
            <el-table-column property="attrValue" label="规格值" width="200"></el-table-column>
          </el-table>
        </el-dialog>
        <!-- 添加订单详情对话框 -->
        <el-dialog title="添加订单详情" :visible.sync="orderItemDialog" width="960px" append-to-body>
          <el-divider content-position="center">订单【 {{ form.orderCode }} 】详细信息</el-divider>
          <el-form :model="mdOrderItem" ref="mdOrderItemForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
            <el-form-item label="工作单号" align="center" prop="workorderCode" width="150">
              <el-input v-model="mdOrderItem.workorderCode" placeholder="请输入工作单号" />
            </el-form-item>
            <el-form-item label="产品编号" align="center" prop="productCode" width="240">
              <el-input v-model="mdOrderItem.productCode" style="width: 200px" placeholder="请先选择产品编号">
                <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
              </el-input>
              <ItemSelect v-if="orderItemDialog" ref="itemSelect" @onSelected="onItemSelected($event, mdOrderItem)"></ItemSelect>
            </el-form-item>
            <el-form-item label="产品名称" align="center" prop="productName" width="150">
              <el-input v-model="mdOrderItem.productName" disabled placeholder="请选择产品编号" />
            </el-form-item>
            <el-form-item label="规格型号" align="center" prop="productSpc" width="150">
              <el-link type="primary" style="width: 200px" :underline="false" @click="openSpc(mdOrderItem.productSpc)">规格详情</el-link>
            </el-form-item>
            <el-form-item label="单位" align="center" prop="unitOfMeasure" width="220">
              <el-input v-model="mdOrderItem.unitOfMeasure" disabled placeholder="请选择产品编号" />
              <!-- <el-select v-model="mdOrderItem.unitOfMeasure" placeholder="请选择单位">
                <el-option v-for="item in measureOptions" :key="item.measureCode" :label="item.measureName"
                  :value="item.measureCode"></el-option>
              </el-select>-->
            </el-form-item>
            <el-form-item label="工序代号" align="center" prop="processCode" width="150">
              <el-input v-model="mdOrderItem.processCode" disabled placeholder="请输入工序代号" />
            </el-form-item>
            <el-form-item label="订单数量" align="center" prop="orderCount" width="150">
              <el-input v-model="mdOrderItem.orderCount" placeholder="请输入订单数量" />
            </el-form-item>
            <el-form-item label="库存数量" align="center" prop="stockCount" width="150">
              <el-input v-model="mdOrderItem.stockCount" placeholder="请输入库存数量" />
            </el-form-item>
            <el-form-item label="生产数量" align="center" prop="quantity" width="150">
              <el-input v-model="mdOrderItem.quantity" placeholder="请输入生产数量" />
            </el-form-item>
            <el-form-item label="投料点" align="center" prop="feedingPoint" width="150">
              <el-input v-model="mdOrderItem.feedingPoint" style="width: 200px" placeholder="请输入投料点">
                <template slot="append" style="padding:2px;">%</template>
              </el-input>
            </el-form-item>
            <el-form-item label="订单日期" align="center" prop="orderDate" width="240">
              <el-date-picker clearable v-model="mdOrderItem.orderDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择订单日期" />
            </el-form-item>
            <el-form-item label="需求日期" align="center" prop="requestDate" width="240">
              <el-date-picker clearable v-model="mdOrderItem.requestDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择需求日期" />
            </el-form-item>
            <el-form-item label="急缓" align="center" prop="priority" width="150">
              <el-input v-model="mdOrderItem.priority" placeholder="请输入急缓" />
            </el-form-item>
            <!-- <el-form-item label="单据状态" align="center" prop="status" width="240">
              <el-select v-model="mdOrderItem.status" placeholder="请选择单据状态">
                <el-option
                  v-for="dict in dict.type.mes_md_order_status"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>-->
            <el-form-item label="箱子资料" align="center" prop="boxInfo" width="150">
              <el-input v-model="mdOrderItem.boxInfo" placeholder="请输入箱子资料" />
            </el-form-item>
            <el-form-item label="底片" align="center" prop="negative" width="150">
              <el-input v-model="mdOrderItem.negative" placeholder="请输入底片" />
            </el-form-item>
            <el-form-item label="价格" align="center" prop="price" width="150">
              <el-input v-model="mdOrderItem.price" placeholder="请输入价格" />
            </el-form-item>
            <div style="text-align: right">
              <el-button type="primary" @click="addOrderItem">确 定</el-button>
              <el-button @click="cancelItem">取 消</el-button>
            </div>
          </el-form>
        </el-dialog>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listOrder,
  getOrder,
  delOrder,
  addOrder,
  updateOrder,
} from "@/api/mes/md/order1";
import ClientSelect from "@/components/clientSelect/single.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
import { listAllUnitmeasure } from "@/api/mes/md/unitmeasure";
import { listRouteproduct } from "@/api/mes/pro/routeproduct";
import { getProroute } from "@/api/mes/pro/proroute";
export default {
  name: "Order",
  dicts: ["mes_md_order_status", "mes_order_type"],
  components: {
    ClientSelect,
    ItemSelect,
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 子表选中数据
      checkedMdOrderItem: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 订单表格数据
      orderList: [],
      // 订单子项表格数据
      mdOrderItemList: [],
      // 选中规格属性数据
      specificationData: [],
      // 添加订单子项弹窗
      orderItemDialog: false,
      // 订单子项
      mdOrderItem: {},
      // 单位数据
      measureOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否显示规格详情弹出层
      dialogTableVisible: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderCode: null,
        orderType: null,
        clientId: null,
        clientCode: null,
        clientName: null,
        productSpc: null,
        orderDate: null,
        salesman: null,
        attr1: null,
        attr2: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        orderCode: [
          {
            required: true,
            message: "订单编号不能为空",
            trigger: "blur",
          },
        ],
        clientId: [
          {
            required: true,
            message: "客户ID不能为空",
            trigger: "blur",
          },
        ],
        clientCode: [
          {
            required: true,
            message: "客户编码不能为空",
            trigger: "blur",
          },
        ],
        clientName: [
          {
            required: true,
            message: "客户名称不能为空",
            trigger: "blur",
          },
        ],
        orderDate: [
          {
            required: true,
            message: "订单日期不能为空",
            trigger: "blur",
          },
        ],
        delFlag: [
          {
            required: true,
            message: "数据行状态(0:正常/1:删除)不能为空",
            trigger: "blur",
          },
        ],
      },
    };
  },
  created() {
    this.getList();
    this.getUnits();
  },
  methods: {
    /** 查询指定物料对应的工序 */
    getRouteproductByItemId(itemId) {
      let params = {
        pageNum: 1,
        pageSize: 10,
        itemId: itemId,
      };
      let routeproduct = [];
      listRouteproduct(params).then((response) => {
        routeproduct = response.rows;
        if (null != routeproduct && routeproduct.length > 0) {
          getProroute(routeproduct[0].routeId).then((response) => {
            this.mdOrderItem.processCode = response.data.routeCode;
          });
        } else {
          this.restOrderItem();
          this.$modal.msgError("请先到【生产管理】——【工艺流程】中关联该产品");
        }
      });
    },
    // 获取单位信息
    getUnits() {
      listAllUnitmeasure().then((response) => {
        this.measureOptions = response.data;
      });
    },
    // 规格属性详情弹出框
    openSpc(row) {
      this.dialogTableVisible = true;
      this.specificationData = JSON.parse(row);
    },
    handleSelectProduct() {
      this.$refs.itemSelect.showFlag = true;
    },
    // 物料选择弹出框
    onItemSelected(obj, row) {
      console.log(obj, row);
      if (obj != undefined && obj != null) {
        row.productId = obj.itemId;
        row.productCode = obj.itemCode;
        row.productName = obj.itemName;
        let spcList = [];
        for (var i = 0; i < obj.specification.length; i++) {
          spcList.push({
            attrName: obj.specification[i].attrName,
            attrValue: obj.specification[i].attrValue,
          });
        }
        row.productSpc = JSON.stringify(spcList);
        row.unitOfMeasure = obj.unitOfMeasure;
        this.getRouteproductByItemId(obj.itemId);
      }
    },
    handleSelectClient() {
      this.$refs.clientSelect.showFlag = true;
    },
    //客户选择弹出框
    onClientSelected(obj) {
      if (obj != undefined && obj != null) {
        this.form.clientId = obj.clientId;
        this.form.clientCode = obj.clientCode;
        this.form.clientName = obj.clientName;
      }
    },
    /** 查询订单列表 */
    getList() {
      this.loading = true;
      listOrder(this.queryParams).then((response) => {
        this.orderList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 添加订单详情
    addOrderItem() {
      this.mdOrderItemList.push(this.mdOrderItem);
      this.orderItemDialog = false;
    },
    // 取消添加订单详情
    cancelItem() {
      this.orderItemDialog = false;
      // this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        orderId: null,
        orderCode: null,
        orderType: null,
        clientId: null,
        clientCode: null,
        clientName: null,
        productSpc: null,
        orderDate: null,
        remark: null,
        salesman: null,
        delFlag: null,
        attr1: null,
        attr2: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
      };
      this.mdOrderItemList = [];
      this.mdOrderItem = {};
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.orderId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加订单";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const orderId = row.orderId || this.ids;
      getOrder(orderId).then((response) => {
        this.form = response.data;
        this.mdOrderItemList = response.data.mdOrderItemList;
        this.open = true;
        this.title = "修改订单";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.form.mdOrderItemList = this.mdOrderItemList;
          if (this.form.orderId != null) {
            updateOrder(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addOrder(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const orderIds = row.orderId || this.ids;
      this.$modal
        .confirm('是否确认删除订单编号为"' + orderIds + '"的数据项？')
        .then(function () {
          return delOrder(orderIds);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 订单子项序号 */
    rowMdOrderItemIndex({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** 订单子项添加按钮操作 */
    handleAddMdOrderItem() {
      this.orderItemDialog = true;
      this.restOrderItem();
    },
    /** 重置订单详情 */
    restOrderItem() {
      this.mdOrderItem = {
        workorderCode: "",
        productId: "",
        productCode: "",
        productName: "",
        productSpc: "",
        unitOfMeasure: "",
        orderCount: "",
        stockCount: "",
        quantity: "",
        feedingPoint: "",
        orderDate: "",
        requestDate: "",
        priority: "",
        status: "CREATE",
        remark: "",
        processCode: "",
        boxInfo: "",
        negative: "",
        price: "",
      };
    },
    /** 订单子项删除按钮操作 */
    handleDeleteMdOrderItem() {
      if (this.checkedMdOrderItem.length == 0) {
        this.$modal.msgError("请先选择要删除的订单子项数据");
      } else {
        const mdOrderItemList = this.mdOrderItemList;
        const checkedMdOrderItem = this.checkedMdOrderItem;
        this.mdOrderItemList = mdOrderItemList.filter(function (item) {
          return checkedMdOrderItem.indexOf(item.index) == -1;
        });
      }
    },
    /** 复选框选中数据 */
    handleMdOrderItemSelectionChange(selection) {
      this.checkedMdOrderItem = selection.map((item) => item.index);
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "mes/md/order/export",
        {
          ...this.queryParams,
        },
        `order_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>

<style scoped>
.el-select,
.el-date-editor {
  width: 200px;
}

.el-date-editor.el-input {
  width: 200px;
}
</style>
